
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>多可用区分布 · 《Terraform入门教程》</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="大可不加冰">
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-prism/prism-vsc-dark-plus.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-image-captions/image-captions.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="7.4.provisioner与user_data.html" />
    
    
    <link rel="prev" href="7.2.依赖反转.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                        <b>1.1.</b>
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="1.Terraform初步体验.html">
            
                <a href="1.Terraform初步体验.html">
            
                    
                        <b>1.2.</b>
                    
                    Terraform 初步体验
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                        <b>1.3.</b>
                    
                    Terraform基础概念
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="2.1.Terraform基础概念——Provider.html">
            
                <a href="2.1.Terraform基础概念——Provider.html">
            
                    
                        <b>1.3.1.</b>
                    
                    Provider
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="2.2.Terraform基础概念——状态管理.html">
            
                <a href="2.2.Terraform基础概念——状态管理.html">
            
                    
                        <b>1.3.2.</b>
                    
                    状态管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="3.Terraform代码的书写.html">
            
                <a href="3.Terraform代码的书写.html">
            
                    
                        <b>1.4.</b>
                    
                    Terraform 代码的书写
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="3.1.类型.html">
            
                <a href="3.1.类型.html">
            
                    
                        <b>1.4.1.</b>
                    
                    类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="3.2.配置语法.html">
            
                <a href="3.2.配置语法.html">
            
                    
                        <b>1.4.2.</b>
                    
                    配置语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="3.3.输入变量.html">
            
                <a href="3.3.输入变量.html">
            
                    
                        <b>1.4.3.</b>
                    
                    输入变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="3.4.输出值.html">
            
                <a href="3.4.输出值.html">
            
                    
                        <b>1.4.4.</b>
                    
                    输出值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="3.5.局部值.html">
            
                <a href="3.5.局部值.html">
            
                    
                        <b>1.4.5.</b>
                    
                    局部值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="3.6.资源.html">
            
                <a href="3.6.资源.html">
            
                    
                        <b>1.4.6.</b>
                    
                    资源
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="3.7.数据源.html">
            
                <a href="3.7.数据源.html">
            
                    
                        <b>1.4.7.</b>
                    
                    数据源
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="3.8.表达式.html">
            
                <a href="3.8.表达式.html">
            
                    
                        <b>1.4.8.</b>
                    
                    表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="3.9.重载文件.html">
            
                <a href="3.9.重载文件.html">
            
                    
                        <b>1.4.9.</b>
                    
                    重载文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="3.10.代码风格规范.html">
            
                <a href="3.10.代码风格规范.html">
            
                    
                        <b>1.4.10.</b>
                    
                    代码风格规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="3.11.checks.html">
            
                <a href="3.11.checks.html">
            
                    
                        <b>1.4.11.</b>
                    
                    Checks
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="4.Terraform模块.html">
            
                <a href="4.Terraform模块.html">
            
                    
                        <b>1.5.</b>
                    
                    Terraform 模块
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="4.1.创建模块.html">
            
                <a href="4.1.创建模块.html">
            
                    
                        <b>1.5.1.</b>
                    
                    创建模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="4.2.使用模块.html">
            
                <a href="4.2.使用模块.html">
            
                    
                        <b>1.5.2.</b>
                    
                    使用模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="4.3.模块元参数.html">
            
                <a href="4.3.模块元参数.html">
            
                    
                        <b>1.5.3.</b>
                    
                    模块元参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="4.4.重构.html">
            
                <a href="4.4.重构.html">
            
                    
                        <b>1.5.4.</b>
                    
                    重构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="4.5.设计新模块的模式.html">
            
                <a href="4.5.设计新模块的模式.html">
            
                    
                        <b>1.5.5.</b>
                    
                    设计新模块的模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="5.Terraform命令行.html">
            
                <a href="5.Terraform命令行.html">
            
                    
                        <b>1.6.</b>
                    
                    Terraform 命令行
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="5.1.命令行配置文件.html">
            
                <a href="5.1.命令行配置文件.html">
            
                    
                        <b>1.6.1.</b>
                    
                    命令行配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="5.2.环境变量.html">
            
                <a href="5.2.环境变量.html">
            
                    
                        <b>1.6.2.</b>
                    
                    环境变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="5.3.资源地址.html">
            
                <a href="5.3.资源地址.html">
            
                    
                        <b>1.6.3.</b>
                    
                    资源地址
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="5.4.apply.html">
            
                <a href="5.4.apply.html">
            
                    
                        <b>1.6.4.</b>
                    
                    apply
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="5.5.console.html">
            
                <a href="5.5.console.html">
            
                    
                        <b>1.6.5.</b>
                    
                    console
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="5.6.destroy.html">
            
                <a href="5.6.destroy.html">
            
                    
                        <b>1.6.6.</b>
                    
                    destroy
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="5.7.fmt.html">
            
                <a href="5.7.fmt.html">
            
                    
                        <b>1.6.7.</b>
                    
                    fmt
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="5.8.force-unlock.html">
            
                <a href="5.8.force-unlock.html">
            
                    
                        <b>1.6.8.</b>
                    
                    force-unlock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="5.9.get.html">
            
                <a href="5.9.get.html">
            
                    
                        <b>1.6.9.</b>
                    
                    get
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="5.10.graph.html">
            
                <a href="5.10.graph.html">
            
                    
                        <b>1.6.10.</b>
                    
                    graph
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11" data-path="5.11.import.html">
            
                <a href="5.11.import.html">
            
                    
                        <b>1.6.11.</b>
                    
                    import
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.12" data-path="5.12.init.html">
            
                <a href="5.12.init.html">
            
                    
                        <b>1.6.12.</b>
                    
                    init
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.13" data-path="5.13.output.html">
            
                <a href="5.13.output.html">
            
                    
                        <b>1.6.13.</b>
                    
                    output
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.14" data-path="5.14.plan.html">
            
                <a href="5.14.plan.html">
            
                    
                        <b>1.6.14.</b>
                    
                    plan
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.15" data-path="5.15.providers.html">
            
                <a href="5.15.providers.html">
            
                    
                        <b>1.6.15.</b>
                    
                    providers
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.15.1" data-path="5.15.1.mirror.html">
            
                <a href="5.15.1.mirror.html">
            
                    
                        <b>1.6.15.1.</b>
                    
                    mirror
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.15.2" data-path="5.15.2.schema.html">
            
                <a href="5.15.2.schema.html">
            
                    
                        <b>1.6.15.2.</b>
                    
                    schema
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.16" data-path="5.16.refresh.html">
            
                <a href="5.16.refresh.html">
            
                    
                        <b>1.6.16.</b>
                    
                    refresh
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.17" data-path="5.17.show.html">
            
                <a href="5.17.show.html">
            
                    
                        <b>1.6.17.</b>
                    
                    show
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18" data-path="5.18.state.html">
            
                <a href="5.18.state.html">
            
                    
                        <b>1.6.18.</b>
                    
                    state
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.18.1" data-path="5.18.1.list.html">
            
                <a href="5.18.1.list.html">
            
                    
                        <b>1.6.18.1.</b>
                    
                    list
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.2" data-path="5.18.2.mv.html">
            
                <a href="5.18.2.mv.html">
            
                    
                        <b>1.6.18.2.</b>
                    
                    mv
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.3" data-path="5.18.3.pull.html">
            
                <a href="5.18.3.pull.html">
            
                    
                        <b>1.6.18.3.</b>
                    
                    pull
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.4" data-path="5.18.4.push.html">
            
                <a href="5.18.4.push.html">
            
                    
                        <b>1.6.18.4.</b>
                    
                    push
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.5" data-path="5.18.5.replace-provider.html">
            
                <a href="5.18.5.replace-provider.html">
            
                    
                        <b>1.6.18.5.</b>
                    
                    replace-provider
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.6" data-path="5.18.6.rm.html">
            
                <a href="5.18.6.rm.html">
            
                    
                        <b>1.6.18.6.</b>
                    
                    rm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.7" data-path="5.18.7.show.html">
            
                <a href="5.18.7.show.html">
            
                    
                        <b>1.6.18.7.</b>
                    
                    show
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.19" data-path="5.19.taint.html">
            
                <a href="5.19.taint.html">
            
                    
                        <b>1.6.19.</b>
                    
                    taint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.20" data-path="5.20.validate.html">
            
                <a href="5.20.validate.html">
            
                    
                        <b>1.6.20.</b>
                    
                    validate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.21" data-path="5.21.untaint.html">
            
                <a href="5.21.untaint.html">
            
                    
                        <b>1.6.21.</b>
                    
                    untaint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22" data-path="5.22.workspace.html">
            
                <a href="5.22.workspace.html">
            
                    
                        <b>1.6.22.</b>
                    
                    workspace
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.22.1" data-path="5.22.1.list.html">
            
                <a href="5.22.1.list.html">
            
                    
                        <b>1.6.22.1.</b>
                    
                    list
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22.2" data-path="5.22.2.select.html">
            
                <a href="5.22.2.select.html">
            
                    
                        <b>1.6.22.2.</b>
                    
                    select
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22.3" data-path="5.22.3.new.html">
            
                <a href="5.22.3.new.html">
            
                    
                        <b>1.6.22.3.</b>
                    
                    new
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22.4" data-path="5.22.4.delete.html">
            
                <a href="5.22.4.delete.html">
            
                    
                        <b>1.6.22.4.</b>
                    
                    delete
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22.5" data-path="5.22.5.show.html">
            
                <a href="5.22.5.show.html">
            
                    
                        <b>1.6.22.5.</b>
                    
                    show
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="6.test.html">
            
                <a href="6.test.html">
            
                    
                        <b>1.7.</b>
                    
                    Terraform Test
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="7.Aha——会心一击.html">
            
                <a href="7.Aha——会心一击.html">
            
                    
                        <b>1.8.</b>
                    
                    Aha——会心一击
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="7.1.有条件创建.html">
            
                <a href="7.1.有条件创建.html">
            
                    
                        <b>1.8.1.</b>
                    
                    有条件创建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="7.2.依赖反转.html">
            
                <a href="7.2.依赖反转.html">
            
                    
                        <b>1.8.2.</b>
                    
                    依赖反转
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.8.3" data-path="7.3.多可用区分布.html">
            
                <a href="7.3.多可用区分布.html">
            
                    
                        <b>1.8.3.</b>
                    
                    多可用区分布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="7.4.provisioner与user_data.html">
            
                <a href="7.4.provisioner与user_data.html">
            
                    
                        <b>1.8.4.</b>
                    
                    provisioner与user_data
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="7.5.destroy-provisioner中使用变量.html">
            
                <a href="7.5.destroy-provisioner中使用变量.html">
            
                    
                        <b>1.8.5.</b>
                    
                    destroy-provisioner中使用变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="7.6.利用null_resource的triggers触发其他资源更新.html">
            
                <a href="7.6.利用null_resource的triggers触发其他资源更新.html">
            
                    
                        <b>1.8.6.</b>
                    
                    利用null_resource的triggers触发其他资源更新
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="7.7.利用null_resource搭配replace_triggered_by更新无法读取的属性.html">
            
                <a href="7.7.利用null_resource搭配replace_triggered_by更新无法读取的属性.html">
            
                    
                        <b>1.8.7.</b>
                    
                    利用 null_resource 搭配 replace_triggered_by 更新无法从服务端读取内容的属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="7.8.创建资源的条件依赖另一个资源的输出时怎么办.html">
            
                <a href="7.8.创建资源的条件依赖另一个资源的输出时怎么办.html">
            
                    
                        <b>1.8.8.</b>
                    
                    创建资源的条件依赖另一个资源的输出时怎么办
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="7.9.利用create_before_destroy调整资源update执行的顺序.html">
            
                <a href="7.9.利用create_before_destroy调整资源update执行的顺序.html">
            
                    
                        <b>1.8.9.</b>
                    
                    利用 create_before_destroy 调整资源 Update 的执行顺序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" data-path="7.10.terraform与自动化.html">
            
                <a href="7.10.terraform与自动化.html">
            
                    
                        <b>1.8.10.</b>
                    
                    Terraform 与自动化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="8.CloudPosse最佳实践.html">
            
                <a href="8.CloudPosse最佳实践.html">
            
                    
                        <b>1.9.</b>
                    
                    来自CloudPosse的Terraform最佳实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="9.后记.html">
            
                <a href="9.后记.html">
            
                    
                        <b>1.10.</b>
                    
                    后记
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >多可用区分布</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#&#x591A;&#x53EF;&#x7528;&#x533A;&#x5206;&#x5E03;"><b>1.8.3.1. </b>&#x591A;&#x53EF;&#x7528;&#x533A;&#x5206;&#x5E03;</a></li></ul></div><a href="#&#x591A;&#x53EF;&#x7528;&#x533A;&#x5206;&#x5E03;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="&#x591A;&#x53EF;&#x7528;&#x533A;&#x5206;&#x5E03;"><a name="&#x591A;&#x53EF;&#x7528;&#x533A;&#x5206;&#x5E03;" class="anchor-navigation-ex-anchor" href="#&#x591A;&#x53EF;&#x7528;&#x533A;&#x5206;&#x5E03;"><i class="fa fa-link" aria-hidden="true"></i></a>1.8.3.1. &#x591A;&#x53EF;&#x7528;&#x533A;&#x5206;&#x5E03;</h1>
<p>&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x76F8;&#x5F53;&#x5E38;&#x89C1;&#x7684;&#x5C0F;&#x6280;&#x5DE7;&#x3002;&#x591A;&#x6570;&#x516C;&#x6709;&#x4E91;&#x4E3A;&#x4E86;&#x9AD8;&#x53EF;&#x7528;&#x6027;&#xFF0C;&#x90FD;&#x5728;&#x5355;&#x4E00;&#x533A;&#x57DF;&#x5185;&#x63D0;&#x4F9B;&#x4E86;&#x591A;&#x53EF;&#x7528;&#x533A;&#x7684;&#x8BBE;&#x8BA1;&#x3002;&#x4E00;&#x4E2A;&#x53EF;&#x533A;&#x662F;&#x4E00;&#x4E2A;&#x903B;&#x8F91;&#x4E0A;&#x7684;&#x6570;&#x636E;&#x4E2D;&#x5FC3;&#xFF0C;&#x5355;&#x4E2A;&#x53EF;&#x7528;&#x533A;&#x53EF;&#x80FD;&#x7531;&#x4E8E;&#x5404;&#x79CD;&#x81EA;&#x7136;&#x707E;&#x5BB3;&#x3001;&#x7F51;&#x7EDC;&#x6545;&#x969C;&#x800C;&#x5BFC;&#x81F4;&#x4E0D;&#x53EF;&#x7528;&#xFF0C;&#x6240;&#x4EE5;&#x516C;&#x6709;&#x4E91;&#x5E94;&#x7528;&#x90E8;&#x7F72;&#x9AD8;&#x53EF;&#x7528;&#x5E94;&#x7528;&#x5E94;&#x65F6;&#x523B;&#x8003;&#x8651;&#x8DE8;&#x53EF;&#x7528;&#x533A;&#x8BBE;&#x8BA1;&#x3002;</p>
<p>&#x5047;&#x5982;&#x6211;&#x4EEC;&#x60F3;&#x8981;&#x521B;&#x5EFA;N&#x53F0;&#x4E0D;&#x540C;&#x7684;&#x4E91;&#x4E3B;&#x673A;&#x5B9E;&#x4F8B;&#xFF0C;&#x5728;Terraform 0.12&#x4E4B;&#x524D;&#x7684;&#x7248;&#x672C;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x53EA;&#x80FD;&#x7528;<code>count</code>&#x914D;&#x5408;&#x6A21;&#x8FD0;&#x7B97;&#x6765;&#x8FBE;&#x6210;&#x8FD9;&#x4E2A;&#x76EE;&#x7684;</p>
<pre class="language-"><code class="lang-hcl"><span class="token keyword">variable<span class="token type variable"> &quot;az&quot; </span></span><span class="token punctuation">{</span>
  <span class="token property">type</span>    <span class="token punctuation">=</span> list(string)
  <span class="token property">default</span> <span class="token punctuation">=</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;cn-bj2-03&quot;</span>,
    <span class="token string">&quot;cn-bj2-04&quot;</span>,
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>

<span class="token keyword">variable<span class="token type variable"> &quot;instance_count&quot; </span></span><span class="token punctuation">{</span>
  <span class="token property">type</span>    <span class="token punctuation">=</span> number
  <span class="token property">default</span> <span class="token punctuation">=</span> <span class="token number">4</span>
<span class="token punctuation">}</span>

<span class="token keyword">data <span class="token type variable">&quot;ucloud_images&quot;</span></span> <span class="token string">&quot;centos&quot;</span> <span class="token punctuation">{</span>
  <span class="token property">name_regex</span> <span class="token punctuation">=</span> <span class="token string">&quot;^CentOS 7&quot;</span>
<span class="token punctuation">}</span>

<span class="token keyword">resource <span class="token type variable">&quot;ucloud_instance&quot;</span></span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
  <span class="token property">count</span>             <span class="token punctuation">=</span> var.instance_count
  <span class="token property">availability_zone</span> <span class="token punctuation">=</span> var.az<span class="token punctuation">[</span>count.index % length(var.az)<span class="token punctuation">]</span>
  <span class="token property">image_id</span>          <span class="token punctuation">=</span> data.ucloud_images.centos.images<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>.id
  <span class="token property">instance_type</span>     <span class="token punctuation">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
  <span class="token property">charge_type</span>       <span class="token punctuation">=</span> <span class="token string">&quot;dynamic&quot;</span>
  <span class="token property">name</span>              <span class="token punctuation">=</span> <span class="token string">&quot;<span class="token interpolation"><span class="token punctuation">$</span><span class="token punctuation">{</span><span class="token keyword">var</span><span class="token punctuation">.</span><span class="token type variable">az</span><span class="token punctuation">[</span><span class="token keyword">count</span><span class="token punctuation">.</span><span class="token type variable">index</span> <span class="token punctuation">%</span> <span class="token function">length</span><span class="token punctuation">(</span><span class="token keyword">var</span><span class="token punctuation">.</span><span class="token type variable">az</span><span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">}</span></span>-<span class="token interpolation"><span class="token punctuation">$</span><span class="token punctuation">{</span><span class="token function">floor</span><span class="token punctuation">(</span><span class="token keyword">count</span><span class="token punctuation">.</span><span class="token type variable">index</span><span class="token punctuation">/</span><span class="token function">length</span><span class="token punctuation">(</span><span class="token keyword">var</span><span class="token punctuation">.</span><span class="token type variable">az</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>&quot;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x7B80;&#x5355;&#x6765;&#x8BF4;&#x5C31;&#x662F;&#x4F7F;&#x7528;<code>count</code>&#x521B;&#x5EFA;&#x591A;&#x5B9E;&#x4F8B;&#x8D44;&#x6E90;&#x65F6;&#xFF0C;&#x7528;<code>var.az[count.index % length(var.az)]</code>&#x53EF;&#x4EE5;&#x5FAA;&#x73AF;&#x4F7F;&#x7528;&#x6BCF;&#x4E2A;&#x53EF;&#x7528;&#x533A;&#xFF0C;&#x4F7F;&#x5F97;&#x673A;&#x5668;&#x5C3D;&#x53EF;&#x80FD;&#x5747;&#x5300;&#x5206;&#x5E03;&#x5728;&#x5404;&#x4E2A;&#x53EF;&#x7528;&#x533A;&#x3002;</p>
<pre class="language-"><code class="lang-bash">$ terraform apply -auto-approve
data.ucloud_images.centos: Refreshing state<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span>: Creating<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: Creating<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: Creating<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span>: Creating<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>10s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>10s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>10s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>10s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>20s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>20s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>20s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>20s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span>: Creation complete after 22s <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-txa2owrp<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span>: Creation complete after 24s <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-v3qxdbju<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: Creation complete after 26s <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-td3x545p<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>30s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>40s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: Creation complete after 43s <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-scq1prqj<span class="token punctuation">]</span>

Apply complete<span class="token operator">!</span> Resources: <span class="token number">4</span> added, <span class="token number">0</span> changed, <span class="token number">0</span> destroyed.
</code></pre>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x4E00;&#x4E0B;&#x521B;&#x5EFA;&#x7684;&#x4E3B;&#x673A;&#x4FE1;&#x606F;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">$ terraform show
<span class="token comment"># data.ucloud_images.centos:</span>
data <span class="token string">&quot;ucloud_images&quot;</span> <span class="token string">&quot;centos&quot;</span> <span class="token punctuation">{</span>
    <span class="token function">id</span>          <span class="token operator">=</span> <span class="token string">&quot;475496684&quot;</span>
    ids         <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token string">&quot;uimage-22noyd&quot;</span>,
        <span class="token string">&quot;uimage-3p0wg0&quot;</span>,
        <span class="token string">&quot;uimage-4keil1&quot;</span>,
        <span class="token string">&quot;uimage-aqvo5l&quot;</span>,
        <span class="token string">&quot;uimage-f1chxn&quot;</span>,
        <span class="token string">&quot;uimage-hq5elw&quot;</span>,
        <span class="token string">&quot;uimage-rkn1v2&quot;</span>,
    <span class="token punctuation">]</span>
    images      <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-02&quot;</span>
            create_time       <span class="token operator">=</span> <span class="token string">&quot;2019-04-23T17:39:46+08:00&quot;</span>
            description       <span class="token operator">=</span> <span class="token string">&quot;&quot;</span>
            features          <span class="token operator">=</span> <span class="token punctuation">[</span>
                <span class="token string">&quot;NetEnhanced&quot;</span>,
                <span class="token string">&quot;HotPlug&quot;</span>,
            <span class="token punctuation">]</span>
            <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uimage-rkn1v2&quot;</span>
            name              <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.0 64&#x4F4D;&quot;</span>
            os_name           <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.0 64&#x4F4D;&quot;</span>
            os_type           <span class="token operator">=</span> <span class="token string">&quot;linux&quot;</span>
            size              <span class="token operator">=</span> <span class="token number">20</span>
            status            <span class="token operator">=</span> <span class="token string">&quot;Available&quot;</span>
            <span class="token builtin class-name">type</span>              <span class="token operator">=</span> <span class="token string">&quot;base&quot;</span>
        <span class="token punctuation">}</span>,
        <span class="token punctuation">{</span>
            availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-02&quot;</span>
            create_time       <span class="token operator">=</span> <span class="token string">&quot;2019-04-16T21:05:03+08:00&quot;</span>
            description       <span class="token operator">=</span> <span class="token string">&quot;&quot;</span>
            features          <span class="token operator">=</span> <span class="token punctuation">[</span>
                <span class="token string">&quot;NetEnhanced&quot;</span>,
                <span class="token string">&quot;HotPlug&quot;</span>,
            <span class="token punctuation">]</span>
            <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uimage-f1chxn&quot;</span>
            name              <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.2 64&#x4F4D;&quot;</span>
            os_name           <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.2 64&#x4F4D;&quot;</span>
            os_type           <span class="token operator">=</span> <span class="token string">&quot;linux&quot;</span>
            size              <span class="token operator">=</span> <span class="token number">20</span>
            status            <span class="token operator">=</span> <span class="token string">&quot;Available&quot;</span>
            <span class="token builtin class-name">type</span>              <span class="token operator">=</span> <span class="token string">&quot;base&quot;</span>
        <span class="token punctuation">}</span>,
        <span class="token punctuation">{</span>
            availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-02&quot;</span>
            create_time       <span class="token operator">=</span> <span class="token string">&quot;2019-09-09T11:40:31+08:00&quot;</span>
            description       <span class="token operator">=</span> <span class="token string">&quot; &quot;</span>
            features          <span class="token operator">=</span> <span class="token punctuation">[</span>
                <span class="token string">&quot;NetEnhanced&quot;</span>,
                <span class="token string">&quot;HotPlug&quot;</span>,
            <span class="token punctuation">]</span>
            <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uimage-aqvo5l&quot;</span>
            name              <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.4 64&#x4F4D;&quot;</span>
            os_name           <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.4 64&#x4F4D;&quot;</span>
            os_type           <span class="token operator">=</span> <span class="token string">&quot;linux&quot;</span>
            size              <span class="token operator">=</span> <span class="token number">20</span>
            status            <span class="token operator">=</span> <span class="token string">&quot;Available&quot;</span>
            <span class="token builtin class-name">type</span>              <span class="token operator">=</span> <span class="token string">&quot;base&quot;</span>
        <span class="token punctuation">}</span>,
        <span class="token punctuation">{</span>
            availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-02&quot;</span>
            create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-05-07T17:40:42+08:00&quot;</span>
            description       <span class="token operator">=</span> <span class="token string">&quot;&quot;</span>
            features          <span class="token operator">=</span> <span class="token punctuation">[</span>
                <span class="token string">&quot;NetEnhanced&quot;</span>,
                <span class="token string">&quot;HotPlug&quot;</span>,
                <span class="token string">&quot;CloudInit&quot;</span>,
            <span class="token punctuation">]</span>
            <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uimage-hq5elw&quot;</span>
            name              <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.6 64&#x4F4D;&quot;</span>
            os_name           <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.6 64&#x4F4D;&quot;</span>
            os_type           <span class="token operator">=</span> <span class="token string">&quot;linux&quot;</span>
            size              <span class="token operator">=</span> <span class="token number">20</span>
            status            <span class="token operator">=</span> <span class="token string">&quot;Available&quot;</span>
            <span class="token builtin class-name">type</span>              <span class="token operator">=</span> <span class="token string">&quot;base&quot;</span>
        <span class="token punctuation">}</span>,
        <span class="token punctuation">{</span>
            availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-02&quot;</span>
            create_time       <span class="token operator">=</span> <span class="token string">&quot;2019-04-16T21:05:05+08:00&quot;</span>
            description       <span class="token operator">=</span> <span class="token string">&quot;&quot;</span>
            features          <span class="token operator">=</span> <span class="token punctuation">[</span>
                <span class="token string">&quot;NetEnhanced&quot;</span>,
                <span class="token string">&quot;HotPlug&quot;</span>,
            <span class="token punctuation">]</span>
            <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uimage-3p0wg0&quot;</span>
            name              <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.3 64&#x4F4D;&quot;</span>
            os_name           <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.3 64&#x4F4D;&quot;</span>
            os_type           <span class="token operator">=</span> <span class="token string">&quot;linux&quot;</span>
            size              <span class="token operator">=</span> <span class="token number">20</span>
            status            <span class="token operator">=</span> <span class="token string">&quot;Available&quot;</span>
            <span class="token builtin class-name">type</span>              <span class="token operator">=</span> <span class="token string">&quot;base&quot;</span>
        <span class="token punctuation">}</span>,
        <span class="token punctuation">{</span>
            availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-02&quot;</span>
            create_time       <span class="token operator">=</span> <span class="token string">&quot;2019-04-16T21:05:02+08:00&quot;</span>
            description       <span class="token operator">=</span> <span class="token string">&quot;&quot;</span>
            features          <span class="token operator">=</span> <span class="token punctuation">[</span>
                <span class="token string">&quot;NetEnhanced&quot;</span>,
                <span class="token string">&quot;HotPlug&quot;</span>,
            <span class="token punctuation">]</span>
            <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uimage-4keil1&quot;</span>
            name              <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.1 64&#x4F4D;&quot;</span>
            os_name           <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.1 64&#x4F4D;&quot;</span>
            os_type           <span class="token operator">=</span> <span class="token string">&quot;linux&quot;</span>
            size              <span class="token operator">=</span> <span class="token number">20</span>
            status            <span class="token operator">=</span> <span class="token string">&quot;Available&quot;</span>
            <span class="token builtin class-name">type</span>              <span class="token operator">=</span> <span class="token string">&quot;base&quot;</span>
        <span class="token punctuation">}</span>,
        <span class="token punctuation">{</span>
            availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-02&quot;</span>
            create_time       <span class="token operator">=</span> <span class="token string">&quot;2019-04-16T21:04:53+08:00&quot;</span>
            description       <span class="token operator">=</span> <span class="token string">&quot;&quot;</span>
            features          <span class="token operator">=</span> <span class="token punctuation">[</span>
                <span class="token string">&quot;NetEnhanced&quot;</span>,
                <span class="token string">&quot;HotPlug&quot;</span>,
            <span class="token punctuation">]</span>
            <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uimage-22noyd&quot;</span>
            name              <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.5 64&#x4F4D;&quot;</span>
            os_name           <span class="token operator">=</span> <span class="token string">&quot;CentOS 7.5 64&#x4F4D;&quot;</span>
            os_type           <span class="token operator">=</span> <span class="token string">&quot;linux&quot;</span>
            size              <span class="token operator">=</span> <span class="token number">20</span>
            status            <span class="token operator">=</span> <span class="token string">&quot;Available&quot;</span>
            <span class="token builtin class-name">type</span>              <span class="token operator">=</span> <span class="token string">&quot;base&quot;</span>
        <span class="token punctuation">}</span>,
    <span class="token punctuation">]</span>
    most_recent <span class="token operator">=</span> <span class="token boolean">false</span>
    name_regex  <span class="token operator">=</span> <span class="token string">&quot;^CentOS 7&quot;</span>
    total_count <span class="token operator">=</span> <span class="token number">7</span>
<span class="token punctuation">}</span>

<span class="token comment"># ucloud_instance.web[1]:</span>
resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
    auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span>
    availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04&quot;</span>
    boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span>
    boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
    charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
    cpu               <span class="token operator">=</span> <span class="token number">1</span>
    cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/Broadwell&quot;</span>
    create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:09:04+08:00&quot;</span>
    disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;df06380a-00e1-42df-8c07-eec67d817f97&quot;</span>
            is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
            size    <span class="token operator">=</span> <span class="token number">20</span>
            <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
        <span class="token punctuation">}</span>,
    <span class="token punctuation">]</span>
    expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-29T00:09:06+08:00&quot;</span>
    <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-td3x545p&quot;</span>
    image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-dhe5m2&quot;</span>
    instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
    ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
            <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.44.37&quot;</span>
        <span class="token punctuation">}</span>,
    <span class="token punctuation">]</span>
    memory            <span class="token operator">=</span> <span class="token number">4</span>
    name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04-0&quot;</span>
    private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.44.37&quot;</span>
    root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
    security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span>
    status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span>
    subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span>
    tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
    vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span>
<span class="token punctuation">}</span>

<span class="token comment"># ucloud_instance.web[2]:</span>
resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
    auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span>
    availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03&quot;</span>
    boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span>
    boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
    charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
    cpu               <span class="token operator">=</span> <span class="token number">1</span>
    cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/IvyBridge&quot;</span>
    create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:09:01+08:00&quot;</span>
    disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;1d7f07c9-7342-431b-85bb-d3ee0022063d&quot;</span>
            is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
            size    <span class="token operator">=</span> <span class="token number">20</span>
            <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
        <span class="token punctuation">}</span>,
    <span class="token punctuation">]</span>
    expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-29T00:09:02+08:00&quot;</span>
    <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-txa2owrp&quot;</span>
    image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-pxplaj&quot;</span>
    instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
    ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
            <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.45.234&quot;</span>
        <span class="token punctuation">}</span>,
    <span class="token punctuation">]</span>
    memory            <span class="token operator">=</span> <span class="token number">4</span>
    name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03-1&quot;</span>
    private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.45.234&quot;</span>
    root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
    security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span>
    status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span>
    subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span>
    tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
    vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span>
<span class="token punctuation">}</span>

<span class="token comment"># ucloud_instance.web[3]:</span>
resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
    auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span>
    availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04&quot;</span>
    boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span>
    boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
    charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
    cpu               <span class="token operator">=</span> <span class="token number">1</span>
    cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/Broadwell&quot;</span>
    create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:09:04+08:00&quot;</span>
    disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;31e2cad6-79a1-4475-a9f5-2c5c95605b18&quot;</span>
            is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
            size    <span class="token operator">=</span> <span class="token number">20</span>
            <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
        <span class="token punctuation">}</span>,
    <span class="token punctuation">]</span>
    expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-29T00:09:04+08:00&quot;</span>
    <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-v3qxdbju&quot;</span>
    image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-dhe5m2&quot;</span>
    instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
    ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
            <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.85.40&quot;</span>
        <span class="token punctuation">}</span>,
    <span class="token punctuation">]</span>
    memory            <span class="token operator">=</span> <span class="token number">4</span>
    name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04-1&quot;</span>
    private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.85.40&quot;</span>
    root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
    security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span>
    status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span>
    subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span>
    tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
    vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span>
<span class="token punctuation">}</span>

<span class="token comment"># ucloud_instance.web[0]:</span>
resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
    auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span>
    availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03&quot;</span>
    boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span>
    boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
    charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
    cpu               <span class="token operator">=</span> <span class="token number">1</span>
    cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/IvyBridge&quot;</span>
    create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:09:04+08:00&quot;</span>
    disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;da27595d-9645-4883-bf95-87b9076ab7e4&quot;</span>
            is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
            size    <span class="token operator">=</span> <span class="token number">20</span>
            <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
        <span class="token punctuation">}</span>,
    <span class="token punctuation">]</span>
    expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-29T00:09:04+08:00&quot;</span>
    <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-scq1prqj&quot;</span>
    image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-pxplaj&quot;</span>
    instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
    ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
            <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.107.152&quot;</span>
        <span class="token punctuation">}</span>,
    <span class="token punctuation">]</span>
    memory            <span class="token operator">=</span> <span class="token number">4</span>
    name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03-0&quot;</span>
    private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.107.152&quot;</span>
    root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
    security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span>
    status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span>
    subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span>
    tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
    vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;&#x4E3B;&#x673A;&#x7684;&#x786E;&#x662F;&#x5747;&#x5300;&#x5730;&#x5206;&#x6563;&#x5728;&#x4E24;&#x4E2A;&#x53EF;&#x7528;&#x533A;&#x4E86;&#x3002;</p>
<p>&#x4F46;&#x662F;&#x8FD9;&#x6837;&#x505A;&#x5728;&#x8C03;&#x6574;&#x53EF;&#x7528;&#x533A;&#x65F6;&#x4F1A;&#x53D1;&#x751F;&#x5927;&#x95EE;&#x9898;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;</p>
<pre class="language-"><code class="lang-hcl"><span class="token keyword">variable<span class="token type variable"> &quot;az&quot; </span></span><span class="token punctuation">{</span>
  <span class="token property">type</span> <span class="token punctuation">=</span> list(string)
  <span class="token property">default</span> <span class="token punctuation">=</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;cn-bj2-03&quot;</span>,
<span class="token comment">#    &quot;cn-bj2-04&quot;,</span>
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x6211;&#x4EEC;&#x7981;&#x7528;&#x4E86;<code>cn-bj2-04</code>&#x53EF;&#x7528;&#x533A;&#xFF0C;&#x6309;&#x9053;&#x7406;&#x6211;&#x4EEC;&#x671F;&#x5F85;&#x7684;&#x53D8;&#x66F4;&#x8BA1;&#x5212;&#x5E94;&#x8BE5;&#x662F;&#x5C06;&#x4E24;&#x53F0;&#x539F;&#x672C;&#x5C5E;&#x4E8E;<code>cn-bj2-04</code>&#x7684;&#x4E3B;&#x673A;&#x5220;&#x9664;&#xFF0C;&#x5728;<code>cn-bj2-03</code>&#x53EF;&#x7528;&#x533A;&#x65B0;&#x589E;&#x4E24;&#x53F0;&#x4E3B;&#x673A;&#x3002;&#x8BA9;&#x6211;&#x4EEC;&#x770B;&#x770B;&#x4F1A;&#x53D1;&#x751F;&#x4EC0;&#x4E48;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">$ terraform plan
Refreshing Terraform state in-memory prior to plan<span class="token punctuation">..</span>.
The refreshed state will be used to calculate this plan, but will not be
persisted to <span class="token builtin class-name">local</span> or remote state storage.

data.ucloud_images.centos: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span><span class="token number">475496684</span><span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-scq1prqj<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span>: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-v3qxdbju<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span>: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-txa2owrp<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-td3x545p<span class="token punctuation">]</span>

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place
-/+ destroy and <span class="token keyword">then</span> create replacement

Terraform will perform the following actions:

  <span class="token comment"># ucloud_instance.web[1] must be replaced</span>
-/+ resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      ~ auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;cn-bj2-03&quot;</span> <span class="token comment"># forces replacement</span>
      ~ boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
        charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
      ~ cpu               <span class="token operator">=</span> <span class="token number">1</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/Broadwell&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:09:04+08:00&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_size    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_type    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;df06380a-00e1-42df-8c07-eec67d817f97&quot;</span>
              - is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
              - size    <span class="token operator">=</span> <span class="token number">20</span>
              - <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-29T00:09:06+08:00&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-td3x545p&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-dhe5m2&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;uimage-rkn1v2&quot;</span>
        instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
      ~ ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
              - <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.44.37&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + isolation_group   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ memory            <span class="token operator">=</span> <span class="token number">4</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04-0&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;cn-bj2-03-1&quot;</span>
      ~ private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.44.37&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + remark            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
      ~ security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
        tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
      ~ vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

  <span class="token comment"># ucloud_instance.web[2] will be updated in-place</span>
  ~ resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
        auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span>
        availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03&quot;</span>
        boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span>
        boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
        charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
        cpu               <span class="token operator">=</span> <span class="token number">1</span>
        cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/IvyBridge&quot;</span>
        create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:09:01+08:00&quot;</span>
        disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
            <span class="token punctuation">{</span>
                <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;1d7f07c9-7342-431b-85bb-d3ee0022063d&quot;</span>
                is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
                size    <span class="token operator">=</span> <span class="token number">20</span>
                <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span>
        expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-29T00:09:02+08:00&quot;</span>
        <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-txa2owrp&quot;</span>
        image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-pxplaj&quot;</span>
        instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
        ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
            <span class="token punctuation">{</span>
                internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
                <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.45.234&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span>
        memory            <span class="token operator">=</span> <span class="token number">4</span>
      ~ name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03-1&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;cn-bj2-03-2&quot;</span>
        private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.45.234&quot;</span>
        root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
        security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span>
        status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span>
        subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span>
        tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
        vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span>
    <span class="token punctuation">}</span>

  <span class="token comment"># ucloud_instance.web[3] must be replaced</span>
-/+ resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      ~ auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;cn-bj2-03&quot;</span> <span class="token comment"># forces replacement</span>
      ~ boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
        charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
      ~ cpu               <span class="token operator">=</span> <span class="token number">1</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/Broadwell&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:09:04+08:00&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_size    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_type    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;31e2cad6-79a1-4475-a9f5-2c5c95605b18&quot;</span>
              - is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
              - size    <span class="token operator">=</span> <span class="token number">20</span>
              - <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-29T00:09:04+08:00&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-v3qxdbju&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-dhe5m2&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;uimage-rkn1v2&quot;</span>
        instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
      ~ ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
              - <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.85.40&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + isolation_group   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ memory            <span class="token operator">=</span> <span class="token number">4</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04-1&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;cn-bj2-03-3&quot;</span>
      ~ private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.85.40&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + remark            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
      ~ security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
        tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
      ~ vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

Plan: <span class="token number">2</span> to add, <span class="token number">1</span> to change, <span class="token number">2</span> to destroy.

------------------------------------------------------------------------

Note: You didn<span class="token string">&apos;t specify an &quot;-out&quot; parameter to save this plan, so Terraform
can&apos;</span>t guarantee that exactly these actions will be performed <span class="token keyword">if</span>
<span class="token string">&quot;terraform apply&quot;</span> is subsequently run.
</code></pre>
<p>&#x53D8;&#x66F4;&#x8BA1;&#x5212;&#x4E0E;&#x671F;&#x671B;&#x7565;&#x6709;&#x4E0D;&#x540C;&#x3002;&#x6211;&#x4EEC;&#x4ED4;&#x7EC6;&#x770B;&#x7EC6;&#x8282;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">  <span class="token comment"># ucloud_instance.web[2] will be updated in-place</span>
  ~ resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
        auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span>
        availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03&quot;</span>
        boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span>
        boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
        charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
        cpu               <span class="token operator">=</span> <span class="token number">1</span>
        cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/IvyBridge&quot;</span>
        create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:09:01+08:00&quot;</span>
        disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
            <span class="token punctuation">{</span>
                <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;1d7f07c9-7342-431b-85bb-d3ee0022063d&quot;</span>
                is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
                size    <span class="token operator">=</span> <span class="token number">20</span>
                <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span>
        expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-29T00:09:02+08:00&quot;</span>
        <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-txa2owrp&quot;</span>
        image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-pxplaj&quot;</span>
        instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
        ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
            <span class="token punctuation">{</span>
                internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
                <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.45.234&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span>
        memory            <span class="token operator">=</span> <span class="token number">4</span>
      ~ name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03-1&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;cn-bj2-03-2&quot;</span>
        private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.45.234&quot;</span>
        root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
        security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span>
        status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span>
        subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span>
        tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
        vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span>
    <span class="token punctuation">}</span>
</code></pre>
<p>&#x539F;&#x672C;&#x540D;&#x4E3A;<code>cn-bj2-03-1</code>&#x7684;&#x4E3B;&#x673A;&#x88AB;&#x66F4;&#x540D;&#x4E3A;<code>cn-bj2-03-2</code>&#x4E86;&#xFF0C;&#x539F;&#x672C;&#x5C5E;&#x4E8E;<code>cn-bj2-04</code>&#x7684;&#x7B2C;&#x4E00;&#x53F0;&#x4E3B;&#x673A;&#x7684;&#x53D8;&#x66F4;&#x8BA1;&#x5212;&#x662F;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">  <span class="token comment"># ucloud_instance.web[1] must be replaced</span>
-/+ resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      ~ auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;cn-bj2-03&quot;</span> <span class="token comment"># forces replacement</span>
      ~ boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
        charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
      ~ cpu               <span class="token operator">=</span> <span class="token number">1</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/Broadwell&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:09:04+08:00&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_size    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_type    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;df06380a-00e1-42df-8c07-eec67d817f97&quot;</span>
              - is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
              - size    <span class="token operator">=</span> <span class="token number">20</span>
              - <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-29T00:09:06+08:00&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-td3x545p&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-dhe5m2&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;uimage-rkn1v2&quot;</span>
        instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
      ~ ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
              - <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.44.37&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + isolation_group   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ memory            <span class="token operator">=</span> <span class="token number">4</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04-0&quot;</span> -<span class="token operator">&gt;</span> <span class="token string">&quot;cn-bj2-03-1&quot;</span>
      ~ private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.44.37&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + remark            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
      ~ security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      ~ subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
        tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
      ~ vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span> -<span class="token operator">&gt;</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>
</code></pre>
<p>&#x5B83;&#x7684;&#x540D;&#x5B57;&#x4ECE;<code>cn-bj2-04-0</code>&#x53D8;&#x6210;&#x4E86;<code>cn-bj2-03-1</code>&#x3002;</p>
<p>&#x4ED4;&#x7EC6;&#x60F3;&#x60F3;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x6BD4;&#x8F83;&#x4F4E;&#x6548;&#x7684;&#x53D8;&#x66F4;&#x8BA1;&#x5212;&#x3002;&#x539F;&#x672C;&#x5C5E;&#x4E8E;<code>cn-bj2-03</code>&#x7684;&#x4E24;&#x53F0;&#x4E3B;&#x673A;&#x5E94;&#x8BE5;&#x4E0D;&#x505A;&#x4EFB;&#x4F55;&#x53D8;&#x66F4;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x5220;&#x9664;<code>cn-bj2-04</code>&#x7684;&#x4E3B;&#x673A;&#xFF0C;&#x518D;&#x8865;&#x5145;&#x4E24;&#x53F0;<code>cn-bj2-03</code>&#x7684;&#x4E3B;&#x673A;&#x5373;&#x53EF;&#x3002;&#x8FD9;&#x662F;&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x7684;&#x662F;<code>count</code>&#xFF0C;&#x800C;<code>count</code>&#x53EA;&#x770B;&#x5143;&#x7D20;&#x5728;&#x5217;&#x8868;&#x4E2D;&#x7684;&#x5E8F;&#x53F7;&#x3002;&#x5F53;&#x6211;&#x4EEC;&#x5220;&#x9664;&#x4E00;&#x4E2A;&#x53EF;&#x7528;&#x533A;&#x65F6;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;&#x4F1A;&#x5F15;&#x8D77;&#x4E3B;&#x673A;&#x5E8F;&#x53F7;&#x7684;&#x91CD;&#x5927;&#x53D8;&#x5316;&#xFF0C;&#x5BFC;&#x81F4;&#x51FA;&#x73B0;&#x5927;&#x91CF;&#x4F4E;&#x6548;&#x7684;&#x53D8;&#x66F4;&#xFF0C;&#x8FD9;&#x5C31;&#x662F;&#x6211;&#x4EEC;&#x5728;&#x8BB2;<code>count</code>&#x4E0E;<code>for_each</code>&#x65F6;&#x5F3A;&#x8C03;&#x8FC7;&#x7684;&#xFF0C;&#x5982;&#x679C;&#x521B;&#x5EFA;&#x7684;&#x8D44;&#x6E90;&#x5B9E;&#x4F8B;&#x5F7C;&#x6B64;&#x4E4B;&#x95F4;&#x51E0;&#x4E4E;&#x5B8C;&#x5168;&#x4E00;&#x81F4;&#xFF0C;&#x90A3;&#x4E48;<code>count</code>&#x6BD4;&#x8F83;&#x5408;&#x9002;&#x3002;&#x5426;&#x5219;&#xFF0C;&#x90A3;&#x4E48;&#x4F7F;&#x7528;<code>for_each</code>&#x4F1A;&#x66F4;&#x52A0;&#x5B89;&#x5168;&#x3002;</p>
<p>&#x8BA9;&#x6211;&#x4EEC;&#x5C1D;&#x8BD5;&#x4F7F;&#x7528;<code>for_each</code>&#x6539;&#x5199;&#x8FD9;&#x6BB5;&#x903B;&#x8F91;&#xFF1A;</p>
<pre class="language-"><code class="lang-hcl"><span class="token keyword">variable<span class="token type variable"> &quot;az&quot; </span></span><span class="token punctuation">{</span>
  <span class="token property">type</span>    <span class="token punctuation">=</span> list(string)
  <span class="token property">default</span> <span class="token punctuation">=</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;cn-bj2-03&quot;</span>,
    <span class="token string">&quot;cn-bj2-04&quot;</span>,
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>

<span class="token keyword">variable<span class="token type variable"> &quot;instance_count&quot; </span></span><span class="token punctuation">{</span>
  <span class="token property">type</span>    <span class="token punctuation">=</span> number
  <span class="token property">default</span> <span class="token punctuation">=</span> <span class="token number">4</span>
<span class="token punctuation">}</span>

<span class="token keyword">locals</span> <span class="token punctuation">{</span>
  <span class="token property">instance_names</span> <span class="token punctuation">=</span> <span class="token punctuation">[</span>for i in range(var.instance_count):<span class="token string">&quot;<span class="token interpolation"><span class="token punctuation">$</span><span class="token punctuation">{</span><span class="token keyword">var</span><span class="token punctuation">.</span><span class="token type variable">az</span><span class="token punctuation">[</span>i<span class="token punctuation">%</span><span class="token function">length</span><span class="token punctuation">(</span><span class="token keyword">var</span><span class="token punctuation">.</span><span class="token type variable">az</span><span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">}</span></span>-<span class="token interpolation"><span class="token punctuation">$</span><span class="token punctuation">{</span><span class="token function">floor</span><span class="token punctuation">(</span>i<span class="token punctuation">/</span><span class="token function">length</span><span class="token punctuation">(</span><span class="token keyword">var</span><span class="token punctuation">.</span><span class="token type variable">az</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>&quot;</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>

<span class="token keyword">data <span class="token type variable">&quot;ucloud_images&quot;</span></span> <span class="token string">&quot;centos&quot;</span> <span class="token punctuation">{</span>
  <span class="token property">name_regex</span> <span class="token punctuation">=</span> <span class="token string">&quot;^CentOS 7&quot;</span>
<span class="token punctuation">}</span>

<span class="token keyword">resource <span class="token type variable">&quot;ucloud_instance&quot;</span></span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
  <span class="token property">for_each</span>          <span class="token punctuation">=</span> toset(local.instance_names)
  <span class="token property">name</span>              <span class="token punctuation">=</span> each.value
  <span class="token property">availability_zone</span> <span class="token punctuation">=</span> var.az<span class="token punctuation">[</span>index(local.instance_names, each.value) % length(var.az)<span class="token punctuation">]</span>
  <span class="token property">image_id</span>          <span class="token punctuation">=</span> data.ucloud_images.centos.images<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>.id
  <span class="token property">instance_type</span>     <span class="token punctuation">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
  <span class="token property">charge_type</span>       <span class="token punctuation">=</span> <span class="token string">&quot;dynamic&quot;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x4E3A;&#x4E86;&#x751F;&#x6210;&#x4E3B;&#x673A;&#x72EC;&#x4E00;&#x65E0;&#x4E8C;&#x7684;&#x540D;&#x5B57;&#xFF0C;&#x6211;&#x4EEC;&#x9996;&#x5148;&#x7528;<code>range</code>&#x51FD;&#x6570;&#x751F;&#x6210;&#x4E86;&#x4E00;&#x4E2A;&#x5E8F;&#x53F7;&#x96C6;&#x5408;&#xFF0C;&#x6BD4;&#x5982;&#x76EE;&#x6807;&#x4E3B;&#x673A;&#x6570;&#x662F;<code>4</code>&#xFF0C;&#x90A3;&#x4E48;<code>range(4)</code>&#x7684;&#x7ED3;&#x679C;&#x5C31;&#x662F;<code>[0, 1, 2, 3]</code>&#xFF1B;&#x7136;&#x540E;&#x6211;&#x4EEC;&#x901A;&#x8FC7;&#x53D6;&#x6A21;&#x8FD0;&#x7B97;&#x4F7F;&#x5F97;&#x540D;&#x5B57;&#x524D;&#x7F00;&#x5728;&#x53EF;&#x7528;&#x533A;&#x5217;&#x8868;&#x4E4B;&#x95F4;&#x5FAA;&#x73AF;&#x9012;&#x589E;&#xFF0C;&#x6700;&#x540E;&#x7528;<code>floor(i/length(var.az))</code>&#x8BA1;&#x7B97;&#x51FA;&#x5F53;&#x524D;&#x5E8F;&#x53F7;&#x5BF9;&#x5E94;&#x5728;&#x5F53;&#x524D;&#x53EF;&#x7528;&#x533A;&#x662F;&#x7B2C;&#x51E0;&#x53F0;&#x3002;&#x4F8B;&#x5982;4&#x53F7;&#x4E3B;&#x673A;&#x5728;&#x7B2C;&#x4E8C;&#x4E2A;&#x53EF;&#x7528;&#x533A;&#x5C31;&#x662F;&#x7B2C;&#x4E8C;&#x53F0;&#xFF0C;&#x751F;&#x6210;&#x7684;&#x540D;&#x5B57;&#x5E94;&#x8BE5;&#x5C31;&#x662F;<code>cn-bj-04-1</code>&#x3002;</p>
<p>&#x6267;&#x884C;&#x7ED3;&#x679C;&#x662F;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">$ terraform apply -auto-approve
data.ucloud_images.centos: Refreshing state<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-1&quot;</span><span class="token punctuation">]</span>: Creating<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-0&quot;</span><span class="token punctuation">]</span>: Creating<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-0&quot;</span><span class="token punctuation">]</span>: Creating<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-1&quot;</span><span class="token punctuation">]</span>: Creating<span class="token punctuation">..</span>.
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-1&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>10s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-0&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>10s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-0&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>10s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-1&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>10s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-1&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>20s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-0&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>20s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-0&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>20s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-1&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>20s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-1&quot;</span><span class="token punctuation">]</span>: Creation complete after 21s <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-fjci1i4o<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-0&quot;</span><span class="token punctuation">]</span>: Creation complete after 23s <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-bkkhmref<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-1&quot;</span><span class="token punctuation">]</span>: Creation complete after 26s <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-amosgdaa<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-0&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>30s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-0&quot;</span><span class="token punctuation">]</span>: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>40s elapsed<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-0&quot;</span><span class="token punctuation">]</span>: Creation complete after 45s <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-kltudgnf<span class="token punctuation">]</span>

Apply complete<span class="token operator">!</span> Resources: <span class="token number">4</span> added, <span class="token number">0</span> changed, <span class="token number">0</span> destroyed.
</code></pre>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x53BB;&#x6389;&#x4E00;&#x4E2A;&#x53EF;&#x7528;&#x533A;&#xFF1A;</p>
<pre class="language-"><code class="lang-hcl"><span class="token keyword">variable<span class="token type variable"> &quot;az&quot; </span></span><span class="token punctuation">{</span>
  <span class="token property">type</span> <span class="token punctuation">=</span> list(string)
  <span class="token property">default</span> <span class="token punctuation">=</span> <span class="token punctuation">[</span>
    <span class="token string">&quot;cn-bj2-03&quot;</span>,
<span class="token comment">#    &quot;cn-bj2-04&quot;,</span>
  <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x68C0;&#x67E5;&#x4E00;&#x4E0B;&#x6267;&#x884C;&#x8BA1;&#x5212;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">$ terraform plan
Refreshing Terraform state in-memory prior to plan<span class="token punctuation">..</span>.
The refreshed state will be used to calculate this plan, but will not be
persisted to <span class="token builtin class-name">local</span> or remote state storage.

data.ucloud_images.centos: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span><span class="token number">475496684</span><span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-1&quot;</span><span class="token punctuation">]</span>: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-amosgdaa<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-0&quot;</span><span class="token punctuation">]</span>: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-bkkhmref<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-03-0&quot;</span><span class="token punctuation">]</span>: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-kltudgnf<span class="token punctuation">]</span>
ucloud_instance.web<span class="token punctuation">[</span><span class="token string">&quot;cn-bj2-04-1&quot;</span><span class="token punctuation">]</span>: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>uhost-fjci1i4o<span class="token punctuation">]</span>

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create
  - destroy

Terraform will perform the following actions:

  <span class="token comment"># ucloud_instance.web[&quot;cn-bj2-03-2&quot;] will be created</span>
  + resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      + auto_renew        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03&quot;</span>
      + boot_disk_size    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + boot_disk_type    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
      + cpu               <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + cpu_platform      <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + create_time       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_size    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_type    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + disk_set          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + expire_time       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + <span class="token function">id</span>                <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-rkn1v2&quot;</span>
      + instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
      + ip_set            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + isolation_group   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + memory            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03-2&quot;</span>
      + private_ip        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + remark            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
      + security_group    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + status            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + subnet_id         <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
      + vpc_id            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

  <span class="token comment"># ucloud_instance.web[&quot;cn-bj2-03-3&quot;] will be created</span>
  + resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      + auto_renew        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03&quot;</span>
      + boot_disk_size    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + boot_disk_type    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span>
      + cpu               <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + cpu_platform      <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + create_time       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_size    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + data_disk_type    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + disk_set          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + expire_time       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + <span class="token function">id</span>                <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-rkn1v2&quot;</span>
      + instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span>
      + ip_set            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + isolation_group   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + memory            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-03-3&quot;</span>
      + private_ip        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + remark            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
      + security_group    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + status            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + subnet_id         <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span>
      + vpc_id            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

  <span class="token comment"># ucloud_instance.web[&quot;cn-bj2-04-0&quot;] will be destroyed</span>
  - resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      - auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span> -<span class="token operator">&gt;</span> null
      - availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04&quot;</span> -<span class="token operator">&gt;</span> null
      - boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span> -<span class="token operator">&gt;</span> null
      - boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span> -<span class="token operator">&gt;</span> null
      - charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span> -<span class="token operator">&gt;</span> null
      - cpu               <span class="token operator">=</span> <span class="token number">1</span> -<span class="token operator">&gt;</span> null
      - cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/Broadwell&quot;</span> -<span class="token operator">&gt;</span> null
      - create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T22:35:53+08:00&quot;</span> -<span class="token operator">&gt;</span> null
      - disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;b214d840-ffec-4958-a3da-3580846fd2a3&quot;</span>
              - is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
              - size    <span class="token operator">=</span> <span class="token number">20</span>
              - <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> null
      - expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:35:53+08:00&quot;</span> -<span class="token operator">&gt;</span> null
      - <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-bkkhmref&quot;</span> -<span class="token operator">&gt;</span> null
      - image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-dhe5m2&quot;</span> -<span class="token operator">&gt;</span> null
      - instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span> -<span class="token operator">&gt;</span> null
      - ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
              - <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.48.82&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> null
      - memory            <span class="token operator">=</span> <span class="token number">4</span> -<span class="token operator">&gt;</span> null
      - name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04-0&quot;</span> -<span class="token operator">&gt;</span> null
      - private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.48.82&quot;</span> -<span class="token operator">&gt;</span> null
      - root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
      - security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span> -<span class="token operator">&gt;</span> null
      - status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span> -<span class="token operator">&gt;</span> null
      - subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span> -<span class="token operator">&gt;</span> null
      - tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span> -<span class="token operator">&gt;</span> null
      - vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span> -<span class="token operator">&gt;</span> null
    <span class="token punctuation">}</span>

  <span class="token comment"># ucloud_instance.web[&quot;cn-bj2-04-1&quot;] will be destroyed</span>
  - resource <span class="token string">&quot;ucloud_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      - auto_renew        <span class="token operator">=</span> <span class="token boolean">true</span> -<span class="token operator">&gt;</span> null
      - availability_zone <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04&quot;</span> -<span class="token operator">&gt;</span> null
      - boot_disk_size    <span class="token operator">=</span> <span class="token number">20</span> -<span class="token operator">&gt;</span> null
      - boot_disk_type    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span> -<span class="token operator">&gt;</span> null
      - charge_type       <span class="token operator">=</span> <span class="token string">&quot;dynamic&quot;</span> -<span class="token operator">&gt;</span> null
      - cpu               <span class="token operator">=</span> <span class="token number">1</span> -<span class="token operator">&gt;</span> null
      - cpu_platform      <span class="token operator">=</span> <span class="token string">&quot;Intel/Broadwell&quot;</span> -<span class="token operator">&gt;</span> null
      - create_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T22:35:53+08:00&quot;</span> -<span class="token operator">&gt;</span> null
      - disk_set          <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - <span class="token function">id</span>      <span class="token operator">=</span> <span class="token string">&quot;6a3f274f-e072-4a46-90f8-edc7dbaa27f7&quot;</span>
              - is_boot <span class="token operator">=</span> <span class="token boolean">true</span>
              - size    <span class="token operator">=</span> <span class="token number">20</span>
              - <span class="token builtin class-name">type</span>    <span class="token operator">=</span> <span class="token string">&quot;local_normal&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> null
      - expire_time       <span class="token operator">=</span> <span class="token string">&quot;2020-11-28T23:35:53+08:00&quot;</span> -<span class="token operator">&gt;</span> null
      - <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;uhost-fjci1i4o&quot;</span> -<span class="token operator">&gt;</span> null
      - image_id          <span class="token operator">=</span> <span class="token string">&quot;uimage-dhe5m2&quot;</span> -<span class="token operator">&gt;</span> null
      - instance_type     <span class="token operator">=</span> <span class="token string">&quot;n-standard-1&quot;</span> -<span class="token operator">&gt;</span> null
      - ip_set            <span class="token operator">=</span> <span class="token punctuation">[</span>
          - <span class="token punctuation">{</span>
              - internet_type <span class="token operator">=</span> <span class="token string">&quot;Private&quot;</span>
              - <span class="token function">ip</span>            <span class="token operator">=</span> <span class="token string">&quot;10.9.176.28&quot;</span>
            <span class="token punctuation">}</span>,
        <span class="token punctuation">]</span> -<span class="token operator">&gt;</span> null
      - memory            <span class="token operator">=</span> <span class="token number">4</span> -<span class="token operator">&gt;</span> null
      - name              <span class="token operator">=</span> <span class="token string">&quot;cn-bj2-04-1&quot;</span> -<span class="token operator">&gt;</span> null
      - private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.9.176.28&quot;</span> -<span class="token operator">&gt;</span> null
      - root_password     <span class="token operator">=</span> <span class="token punctuation">(</span>sensitive value<span class="token punctuation">)</span>
      - security_group    <span class="token operator">=</span> <span class="token string">&quot;firewall-juhsrlvr&quot;</span> -<span class="token operator">&gt;</span> null
      - status            <span class="token operator">=</span> <span class="token string">&quot;Running&quot;</span> -<span class="token operator">&gt;</span> null
      - subnet_id         <span class="token operator">=</span> <span class="token string">&quot;subnet-dtu3dgpr&quot;</span> -<span class="token operator">&gt;</span> null
      - tag               <span class="token operator">=</span> <span class="token string">&quot;Default&quot;</span> -<span class="token operator">&gt;</span> null
      - vpc_id            <span class="token operator">=</span> <span class="token string">&quot;uvnet-f1c3jq2b&quot;</span> -<span class="token operator">&gt;</span> null
    <span class="token punctuation">}</span>

Plan: <span class="token number">2</span> to add, <span class="token number">0</span> to change, <span class="token number">2</span> to destroy.

------------------------------------------------------------------------

Note: You didn<span class="token string">&apos;t specify an &quot;-out&quot; parameter to save this plan, so Terraform
can&apos;</span>t guarantee that exactly these actions will be performed <span class="token keyword">if</span>
<span class="token string">&quot;terraform apply&quot;</span> is subsequently run.
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;&#x539F;&#x6765;&#x5C5E;&#x4E8E;<code>cn-bj2-03</code>&#x7684;&#x4E24;&#x53F0;&#x4E3B;&#x673A;&#x539F;&#x5C01;&#x4E0D;&#x52A8;&#xFF0C;&#x5220;&#x9664;&#x4E86;&#x5C5E;&#x4E8E;<code>cn-bj2-04</code>&#x7684;&#x4E24;&#x53F0;&#x4E3B;&#x673A;&#xFF0C;&#x5E76;&#x4E14;&#x5728;<code>cn-bj2-03</code>&#x53EF;&#x7528;&#x533A;&#x65B0;&#x589E;&#x4E24;&#x53F0;&#x4E3B;&#x673A;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="7.2.依赖反转.html" class="navigation navigation-prev " aria-label="Previous page: 依赖反转">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="7.4.provisioner与user_data.html" class="navigation navigation-next " aria-label="Next page: provisioner与user_data">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"多可用区分布","level":"1.8.3","depth":2,"next":{"title":"provisioner与user_data","level":"1.8.4","depth":2,"path":"7.4.provisioner与user_data.md","ref":"./7.4.provisioner与user_data.md","articles":[]},"previous":{"title":"依赖反转","level":"1.8.2","depth":2,"path":"7.2.依赖反转.md","ref":"./7.2.依赖反转.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-highlight","prism","prism-themes","fontsettings","sharing","-lunr","-search","search-pro","livereload","image-captions","sitemap-general","anchor-navigation-ex"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{"css":["prism-themes/themes/prism-vsc-dark-plus.css"],"lang":{"shell":"bash","cmd":"bash"}},"livereload":{},"search-pro":{},"sitemap-general":{"prefix":"https://lonegunmanb.github.io/introduction-terraform/"},"fontsettings":{"family":"sans","size":2,"theme":"white"},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"prism-themes":{},"sharing":{"all":["facebook","google","twitter","weibo","instapaper"],"facebook":true,"google":false,"instapaper":false,"twitter":true,"vk":false,"weibo":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"image-captions":{"caption":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","variable_name":"_pictures"}},"theme":"default","author":"大可不加冰","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"_pictures":[{"backlink":"index.html#fig1.1.1","level":"1.1","list_caption":"Figure: Nomad、Consul、Vault、Terraform 组成的 HashiStack","alt":"Nomad、Consul、Vault、Terraform 组成的 HashiStack","nro":1,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-13/1605243540985-image.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Nomad、Consul、Vault、Terraform 组成的 HashiStack","attributes":{},"skip":false,"key":"1.1.1"},{"backlink":"index.html#fig1.1.2","level":"1.1","list_caption":"Figure: Terraform 著名教材《Terraform Up & Running》，建议直接阅读第二版","alt":"Terraform 著名教材《Terraform Up & Running》，建议直接阅读第二版","nro":2,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-12-23/1608689176373-image.png","index":2,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Terraform 著名教材《Terraform Up & Running》，建议直接阅读第二版","attributes":{},"skip":false,"key":"1.1.2"},{"backlink":"./2.1.Terraform基础概念——Provider.html#fig1.3.1.1","level":"1.3.1","list_caption":"Figure: Terraform通过RPC调用插件，插件代码通过调用SDK操作远程资源","alt":"Terraform通过RPC调用插件，插件代码通过调用SDK操作远程资源","nro":3,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-16/1605496195438-image.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Terraform通过RPC调用插件，插件代码通过调用SDK操作远程资源","attributes":{},"skip":false,"key":"1.3.1.1"},{"backlink":"./2.1.Terraform基础概念——Provider.html#fig1.3.1.2","level":"1.3.1","list_caption":"Figure: registry.terraform.io上的插件页面","alt":"registry.terraform.io上的插件页面","nro":4,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-19/1605799350775-image.png","index":2,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"registry.terraform.io上的插件页面","attributes":{},"skip":false,"key":"1.3.1.2"},{"backlink":"./2.1.Terraform基础概念——Provider.html#fig1.3.1.3","level":"1.3.1","list_caption":"Figure: registry.terraform.io的搜索页面","alt":"registry.terraform.io的搜索页面","nro":5,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-16/1605498907942-image.png","index":3,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"registry.terraform.io的搜索页面","attributes":{},"skip":false,"key":"1.3.1.3"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.1","level":"1.3.2","list_caption":"Figure: Consul的GUI界面","alt":"Consul的GUI界面","nro":6,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220224455.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Consul的GUI界面","attributes":{},"skip":false,"key":"1.3.2.1"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.2","level":"1.3.2","list_caption":"Figure: Consul 中可以看到名为 `localstack-aws` 的键","alt":"Consul 中可以看到名为 `localstack-aws` 的键","nro":7,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220230042.png","index":2,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Consul 中可以看到名为 `localstack-aws` 的键","attributes":{},"skip":false,"key":"1.3.2.2"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.3","level":"1.3.2","list_caption":"Figure: 键的内容","alt":"键的内容","nro":8,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220230136.png","index":3,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"键的内容","attributes":{},"skip":false,"key":"1.3.2.3"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.4","level":"1.3.2","list_caption":"Figure: 键依然存在","alt":"键依然存在","nro":9,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220230312.png","index":4,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"键依然存在","attributes":{},"skip":false,"key":"1.3.2.4"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.5","level":"1.3.2","list_caption":"Figure: 内容已被清空","alt":"内容已被清空","nro":10,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220230350.png","index":5,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"内容已被清空","attributes":{},"skip":false,"key":"1.3.2.5"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.6","level":"1.3.2","list_caption":"Figure: 多了一个同名的文件夹","alt":"多了一个同名的文件夹","nro":11,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225100309.png","index":6,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"多了一个同名的文件夹","attributes":{},"skip":false,"key":"1.3.2.6"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.7","level":"1.3.2","list_caption":"Figure: localstack-aws 文件夹内部","alt":"localstack-aws 文件夹内部","nro":12,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225100354.png","index":7,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"localstack-aws 文件夹内部","attributes":{},"skip":false,"key":"1.3.2.7"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.8","level":"1.3.2","list_caption":"Figure: `.lock` 内容","alt":"`.lock` 内容","nro":13,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225180803.png","index":8,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"`.lock` 内容","attributes":{},"skip":false,"key":"1.3.2.8"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.9","level":"1.3.2","list_caption":"Figure: `.lockinfo` 内容","alt":"`.lockinfo` 内容","nro":14,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225180852.png","index":9,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"`.lockinfo` 内容","attributes":{},"skip":false,"key":"1.3.2.9"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.10","level":"1.3.2","list_caption":"Figure: 重新访问Consul","alt":"重新访问Consul","nro":15,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225101100.png","index":10,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"重新访问Consul","attributes":{},"skip":false,"key":"1.3.2.10"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.11","level":"1.3.2","list_caption":"Figure: 将代码复制到不同的文件夹中保存","alt":"将代码复制到不同的文件夹中保存","nro":16,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-17/1605571444613-image.png","index":11,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"将代码复制到不同的文件夹中保存","attributes":{},"skip":false,"key":"1.3.2.11"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.12","level":"1.3.2","list_caption":"Figure: 重新访问 Consul，目前有一个键","alt":"重新访问 Consul，目前有一个键","nro":17,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225174932.png","index":12,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"重新访问 Consul，目前有一个键","attributes":{},"skip":false,"key":"1.3.2.12"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.13","level":"1.3.2","list_caption":"Figure: Consul 中多了一个 `localstack-aws-env:feature1`","alt":"Consul 中多了一个 `localstack-aws-env:feature1`","nro":18,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225175538.png","index":13,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Consul 中多了一个 `localstack-aws-env:feature1`","attributes":{},"skip":false,"key":"1.3.2.13"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.14","level":"1.3.2","list_caption":"Figure: 此时 `localstack-aws-env:feature1` 的内容","alt":"此时 `localstack-aws-env:feature1` 的内容","nro":19,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225175806.png","index":14,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"此时 `localstack-aws-env:feature1` 的内容","attributes":{},"skip":false,"key":"1.3.2.14"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.15","level":"1.3.2","list_caption":"Figure: `localstack-aws-env:feature1` 被删除了","alt":"`localstack-aws-env:feature1` 被删除了","nro":20,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225180126.png","index":15,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"`localstack-aws-env:feature1` 被删除了","attributes":{},"skip":false,"key":"1.3.2.15"},{"backlink":"./5.10.graph.html#fig1.6.10.1","level":"1.6.10","list_caption":"Figure: 生成的依赖图","alt":"生成的依赖图","nro":21,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-25/1606272727693-image.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"生成的依赖图","attributes":{},"skip":false,"key":"1.6.10.1"},{"backlink":"8.CloudPosse最佳实践.html#fig1.9.1","level":"1.9","list_caption":"Figure: Terraform 输出值的命名要对称","alt":"Terraform 输出值的命名要对称","nro":22,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2021-11-28/1638086002974-image.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Terraform 输出值的命名要对称","attributes":{},"skip":false,"key":"1.9.1"}]},"title":"《Terraform入门教程》","gitbook":"*"},"file":{"path":"7.3.多可用区分布.md","mtime":"2024-05-25T00:11:31.217Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2024-06-24T12:39:39.308Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    

    </body>
</html>

